<template>
	<view>
		<view class="u-card-box u-m-b-20" v-for="item in exchangeData.exchangeList" :key="item.id" @click="goFriendDetail(item.id)">
			<view class="u-p-b-20 u-flex u-row-between u-col-top u-line-bottom">
				<view>
					<u-image width="140rpx" height="140rpx" border-radius="20" :src="item.head_img"></u-image>
					<view class="u-text-center u-font-24 u-m-t-15 number_box">
						<view class="u-font-bold u-font-26">{{item.number}}</view>
						<view class="u-font-23 u-m-l-10">能量值</view>
					</view>
				</view>
				
				<view class="u-flex-1 u-flex-1 u-flex u-flex-col u-row-between u-col-top u-ellipsis u-m-l-20 u-p-t-5 u-p-b-5">
					<view class="u-flex">
						<view class="u-font-bold u-font-30 u-m-r-10">{{item.name}}</view>
						<!-- <view class="u-m-r-10" v-if="![0,'0'].includes(item.sex)">
							<u-icon size="32" :color="item.sex == 1 ? '#4399FF' : '#FF69B1'" :name="item.sex == 1 ? 'nanxing' : 'nvxing'" custom-prefix="custom-icon" />
						</view> -->
						<view class="u-m-r-10" v-if="item.is_authentication == 2">
							<u-icon size="32" color="#FB6316" name="renzheng" custom-prefix="custom-icon" />
						</view>
						<view class="u-m-r-10" v-if="item.is_company_user == 1">
							<u-icon size="32" color="#F8494D" name="qiye1" custom-prefix="custom-icon" />
						</view>
						<view class="u-tag-box" :class="item.president_class" v-if="[5,6,7,8].includes(item.president_status)">
							{{ item.president_name }}
						</view>
					</view>
					<view class="u-m-t-10 u-color-gray u-width-100 u-ellipsis">{{item.address}}</view>
					<view class="u-m-t-10 u-flex">
						<view class="u-text-center">
							<view class="u-color-gray u-font-24">举办酒局</view>
							<view class="u-font-bold u-font-34 u-m-t-10">{{item.data_num.space || 0}}场</view>
						</view>
						<view class="u-m-l-40 u-m-r-40 line"></view>
						<view class="u-text-center">
							<view class="u-color-gray u-font-24">参与酒局</view>
							<view class="u-font-bold u-font-34 u-m-t-10">{{item.data_num.join_num || 0}}场</view>
						</view>
					</view>
				</view>
			</view>
			<view class="u-m-t-20 u-flex u-row-between">
				<view class="u-flex-1 u-m-r-10 refend_btn" @click.native.stop="apply(2,item.card_id)">拒绝</view>
				<view class="u-flex-1 u-m-l-10 agree_btn" @click.native.stop="apply(1,item.card_id)">同意</view>
			</view>
		</view>
		<view class="line_tag" v-if="exchangeData.finishList[0].id">以下为已处理的交换申请</view>
		<view class="u-card-box u-m-b-20 u-flex u-row-between u-col-top" v-for="item2 in exchangeData.finishList" :key="item2.id" @click="goFriendDetail(item2.id)">
			<view class="u-flex-1 u-flex u-col-top u-ellipsis">
				<view>
					<u-image width="140rpx" height="140rpx" border-radius="20" :src="item2.head_img"></u-image>
					<view class="u-text-center u-font-24 u-m-t-15 number_box">
						<view class="u-font-bold u-font-26">{{item2.number}}</view>
						<view class="u-font-23 u-m-l-10">能量值</view>
					</view>
				</view>
				
				<view class="u-flex u-flex-1 u-flex-col u-row-between u-col-top u-ellipsis u-m-l-20 u-p-t-5 u-p-b-5">
					<view class="u-flex">
						<view class="u-font-bold u-font-30 u-m-r-10">{{item2.name}}</view>
						<!-- <view class="u-m-r-10" v-if="![0,'0'].includes(item2.sex)">
							<u-icon size="32" :color="item2.sex == 1 ? '#4399FF' : '#FF69B1'" :name="item2.sex == 1 ? 'nanxing' : 'nvxing'" custom-prefix="custom-icon" />
						</view> -->
						<view class="u-m-r-10" v-if="item2.is_authentication == 2">
							<u-icon size="32" color="#FB6316" name="renzheng" custom-prefix="custom-icon" />
						</view>
						<view class="u-m-r-10" v-if="item2.is_company_user == 1">
							<u-icon size="32" color="#F8494D" name="qiye1" custom-prefix="custom-icon" />
						</view>
						<view class="u-tag-box" :class="item2.president_class" v-if="[5,6,7,8].includes(item2.president_status) && item2.president_class">
							{{ item2.president_name }}
						</view>
					</view>
					<view class="u-m-t-12 u-flex u-row-between u-ellipsis u-width-100">
						<view class="u-m-r-10 u-width-100 u-ellipsis">{{item2.address}}</view>
						<view>
							<u-icon name="man-add-fill" color="#F96257" size="60" @click.native.stop="addPerson(item2.id)" v-if="item2.status == 0"></u-icon>
							<u-icon name="bodadianhua" custom-prefix="custom-icon" color="#F96257" size="60" @click.native.stop="callMobile(item2.phone)" v-else></u-icon>
						</view>
					</view>
					<view class="u-m-t-10 u-flex">
						<view class="u-text-center">
							<view class="u-color-gray u-font-24">举办酒局</view>
							<view class="u-font-bold u-font-34 u-m-t-10">{{item2.data_num.space || 0}}场</view>
						</view>
						<view class="u-m-l-40 u-m-r-40 line"></view>
						<view class="u-text-center">
							<view class="u-color-gray u-font-24">参与酒局</view>
							<view class="u-font-bold u-font-34 u-m-t-10">{{item2.data_num.join_num || 0}}场</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: ["data"],
		watch:{
			data(newValue,oldValue){
				this.exchangeData = newValue
			}
		},
		data() {
			return {
				exchangeData:{}
			}
		},
		methods:{
			callMobile(val){
				this.$emit("callMobile",val)
			},		
			addPerson(id){
				this.$emit("addPerson",id)
			},
			goFriendDetail(val){
				this.$emit("goFriendDetail",val)
			},
			apply(type,id){
				const params = {
					type: type,
					card_id: id
				}
				this.$emit("cardApply",params)
			}
		}
	}
</script>

<style scoped>
	.refend_btn {
		background: #868B9A;
		color: #fff;
		padding: 20rpx;
		border-radius: 50rpx;
		text-align: center;
	}

	.agree_btn {
		background: #F96257;
		color: #fff;
		padding: 20rpx;
		border-radius: 50rpx;
		text-align: center;
	}

	.line_tag {
		padding: 15rpx 20rpx;
		font-size: 22rpx;
		color: #fff;
		background: #2C76ED;
		display: inline-block;
		border-radius: 20rpx;
		margin: 50rpx 0 30rpx 0;
	}
</style>